public class Demo4 {
    public static void main(String[] args) {
        try {
            throw new NullPointerException();
        } catch (NullPointerException e) {
            System.out.println("捕获空指针异常");
            e.printStackTrace();
        }catch (RuntimeException  e) {
            System.out.println("捕获运行时异常");
            e.printStackTrace();
        }
    }
}
